using System;
using System.Runtime.Serialization;

namespace Elderos.Ontology
{
    [DataContract]
    public struct AttValue : IEquatable<AttValue>
    {
        public override int GetHashCode()
        {
            return ID;
        }

        [DataMember]
        public int ID { get; set; }

        [DataMember]
        public int EntityID { get; set; }

        [DataMember]
        public int AttID { get; set; }

        [DataMember]
        public string Value { get; set; }

        public bool Equals(AttValue other)
        {
            return ID == other.ID;
        }

        public override bool Equals(object obj)
        {
            if (ReferenceEquals(null, obj)) return false;
            return obj is AttValue && Equals((AttValue) obj);
        }

        public static bool operator ==(AttValue first, AttValue second)
        {
            return first.ID == second.ID;
        }

        public static bool operator !=(AttValue first, AttValue second)
        {
            return !(first == second);
        }
    }
}